|
DEMO: The Chords Extension
|
The methods provided in the Chords extension allow music-savvy Web developers to apply their knowledge of music in a manner that is familiar to them, proving invaluable as an aid in the development of Web-based music instruction applications and intelligent musical "jam along" applications.
| Taste Some Chords |
In the table below, each row contains a button that will play a musical chord when clicked. To the right of each button is the source code of the playChord method call for each button. Each chord in the table is being played on a different instrument from the Beatnik soundbank. Combining different instruments and chords demonstrates very clearly the vast array of sound textures that can be achieved using just the built-in Beatnik soundbank.
Go ahead and taste some chords...
| Try Your Hand |
Now that you have seen what a couple of musical chords look like when expressed in the syntax required by the playChord method, why not try your hand at entering some chords of your own.
The interface below is designed to resemble a call to the playChord method and lets you edit all of the method's parameters. An entry box is provided for each of the method's parameters, with the exception of the MidiChannel1to16 parameter which has a fixed value of 1 in this interface. To the left of each parameter entry box is the name of the parameter and, wherever reference information is available for a parameter, the parameter name is linked to the reference information.
So, go ahead and tweak the parameters in the interface below. When you have a set of values that you like and you'd like to preview the chord that would result from those settings, just hit the "Preview" button...
You can also "seed" the interface with values by returning to the previous Taste Some Chords section and clicking on any of the buttons to play a chord. When you scroll back down again to this section, then the parameters in the playChord Method Editor's interface will be seeded with the values needed to play the chord you just played. You can then edit the parameters from there to derive new chords from those listed in the previous section.
Don't be thrown off by the fact that each parameter is on its own new line. This layout was chosen so that it wouldn't be necessary to scroll horizontally all the time to edit different parameters. It is also perfectly acceptable in the JavaScript language to break up a method or function call over several lines, provided that you don't end a line on an unterminated string literal (ie. start a string parameter with an opening quote but don't close the string on the same line). For example, the following method call is perfectly valid in JavaScript...
myMusicObject.playChord ( 1, 1, 8, 'Emaj7#11', 4, 'E', 127, 1300 ); |
| Strum It! |
Thanks to the Chord extension's Music.getChordNotes static method, the interface below lets you strum the individual notes that make up the last chord you played using the previous Taste Some Chords and Try Your Hand sections.
Run your mouse across the green blocks below to strum the chord...
Above each green block is a textbox containing the name of the note that corresponds to that block. If you go back up to one of the previous sections and play a different chord, then when you scroll back down to this section you will notice that the notes will have changed.
NOTE : Because the Music.getChordNotes method returns an array containing the MIDI note numbers of the notes in the chord, using the Music.getNoteName method on the individual notes that make up the chord will not always generate the note names one might expect. This is because the Music.getNoteName always uses a sharp accidental ("#") in place of a flat accidental ("b") for notes that require an accidental. So, you may see sharp note names making up some chords in places where you'd otherwise expect to see flat notes, based on your musical understanding of the chords.